//package com.faneui.transfer.gateway.filter;
//
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component;
//
//import com.exingcai.exception.BusinessException;
//
//import com.faneui.transfer.gateway.vo.resp.BaseResp;
//
//@Aspect
//@Component
//public class ControllerLogAopper {
//
//	private static Logger logger = LoggerFactory.getLogger("");
//
//	@Around(value = "@annotation(org.springframework.web.bind.annotation.RequestMapping) && within(com.faneui.transfer.gateway.controller.*Controller))"
//			+ "&&(execution(public BaseResp+ *(..)))")
//	public Object aroundMethod(ProceedingJoinPoint point) {
////		String uuid = UUID.randomUUID().toString(); // 日志唯一标识
//		BaseResp resp = null;
//		StringBuffer baseSb = new StringBuffer();
//		MethodSignature signature = (MethodSignature) point.getSignature();
//		String className = point.getTarget().getClass().getName();
//		className = className.substring(className.lastIndexOf(".") + 1);
//		baseSb.append(" ");
//		baseSb.append(className);
//		baseSb.append("#");
//		baseSb.append(point.getSignature().getName()); // 方法名
//
//		Class<?> returnType = signature.getReturnType(); // 得到方法返回类型
//		baseSb.append(":");
//		Object[] args = point.getArgs();
//		StringBuffer reqStr = new StringBuffer();
//		for (Object o : args) {
//			if (o != null) {
//				reqStr.append(o.toString());
//			}
//		}
//		logger.info(baseSb.toString() + reqStr.toString());
//		try {
//			resp = (BaseResp) point.proceed(); // 执行被代理方法
//		} catch (Throwable ex) {
//			logger.info("系统异常:" + ex.getMessage());
//			logger.error("系统异常", ex);
//			try {
//				if (!returnType.getName().equals("void")) {
//					resp = (BaseResp) returnType.newInstance(); // 根据返回类型创建实例
//					resp.setMsg((ex instanceof BusinessException) ? ((BusinessException) ex).getMessage() : "系统异常");
//					resp.setSuccess(false);
//				}
//				if (!(ex instanceof BusinessException))
//					logger.error("系统异常", ex);
//			} catch (Exception e) {
//				logger.error("系统异常", e);
//			}
//		}
//		logger.info(baseSb.toString() + (resp != null ? resp : ""));
//		return resp;
//	}
// 
//} 
